//
//  ViewController.m
//  CTMediatorTest
//
//  Created by dafiger on 2020.04.14.
//  Copyright © 2020 dafiger. All rights reserved.
//

#import "ViewController.h"

#import <CTMediatorTestACategory/CTMediator+A.h>
#import <CTMediatorTestBCategory/CTMediator+B.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor lightGrayColor];
    
    [self performSelector:@selector(jumpA) withObject:nil afterDelay:2.0f];
    // Do any additional setup after loading the view.
}

- (void)jumpA {
    id obj_a = [[CTMediator sharedInstance] A_FirstVC:^(NSString *result) {
        NSLog(@"%@", result);
    }];
    if (!obj_a) {
        return;
    }
    if ([obj_a isKindOfClass:[UIViewController class]]) {
        NSLog(@"准备调用 A");
        UIViewController *firstVC = (UIViewController *)obj_a;
        [self presentViewController:firstVC animated:YES completion:nil];
    }
}

@end
